package com.xunji.user.vo.rep;

import com.xunji.user.entity.Role;
import com.xunji.user.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;


@ApiModel("人员详情查看")
@Data
public class UserQueryResponse {

    @ApiModelProperty("人员id")
    private String id;

    @ApiModelProperty("人员姓名")
    private String name;

    @ApiModelProperty("登录名")
    private String loginName;

    @ApiModelProperty("登录密码")
    private String password;

    @ApiModelProperty("性别，1：男，2：女")
    private Integer gender;

    @ApiModelProperty("部门id")
    private Integer departmentId;

    @ApiModelProperty("部门名称")
    private String departmentName;

    @ApiModelProperty("联系方式")
    private String phoneNumber;

    //@ApiModelProperty("是否关联用户")
    //private Integer withLoginName;

    @ApiModelProperty("状态，1：启用，2：禁用")
    private Integer status;

    @ApiModelProperty("头像路径")
    private String image;

    @ApiModelProperty("头像预览地址")
    private String imagePreviewUrl;

    @ApiModelProperty("所属角色")
    private List<Role> roles;


    public static UserQueryResponse getInstance(User user){
        UserQueryResponse userQueryResponse = new UserQueryResponse();
        userQueryResponse.setId(user.getId());
        userQueryResponse.setName(user.getName());
        userQueryResponse.setLoginName(user.getLoginName());
        userQueryResponse.setPassword(user.getPassword());
        userQueryResponse.setGender(user.getGender());
        userQueryResponse.setDepartmentId(user.getDepartmentId());
        userQueryResponse.setPhoneNumber(user.getPhoneNumber());
        //userQueryResponse.setWithLoginName(user.getWithLoginName());
        userQueryResponse.setStatus(user.getStatus());
        userQueryResponse.setImage(user.getImage());
        return userQueryResponse;
    }

}
